import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/home',
    name: 'Home',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Index.vue'),
    children: [
      { name: 'Student', path: '/student', component: () => import('../views/Student') },
      { name: 'User', path: '/userinfo', component: () => import('../views/User') },
      { path: '/', redirect: '/student' }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
